﻿using System.Collections.Generic;
using System.Web.UI.WebControls;
using Framework.Library.Data.DAL;

namespace Framework.Library.Base.DataAccess
{
    public class AdsAccess
    {
        public static void LoadAds(List<ADSItem> dtRoles, TreeNodeCollection lstItems)
        {
            lstItems.Clear();
            var rootNode = new TreeNode("Root", "0");
            lstItems.Add(rootNode);
            if (dtRoles != null)
            {
                foreach (ADSItem row in dtRoles)
                {
                    var childNode = new TreeNode(row.NAME, row.ID.ToString());
                    childNode.Expanded = false;
                    rootNode.ChildNodes.Add(childNode);
                }
            }
        }
    }
}